package pe.edu.upc.dsd.deal.service;

public class DealServiceProxy implements pe.edu.upc.dsd.deal.service.DealService {
  private String _endpoint = null;
  private pe.edu.upc.dsd.deal.service.DealService dealService = null;
  
  public DealServiceProxy() {
    _initDealServiceProxy();
  }
  
  public DealServiceProxy(String endpoint) {
    _endpoint = endpoint;
    _initDealServiceProxy();
  }
  
  private void _initDealServiceProxy() {
    try {
      dealService = (new pe.edu.upc.dsd.deal.service.impl.DealServiceImplServiceLocator()).getDealServiceImplPort();
      if (dealService != null) {
        if (_endpoint != null)
          ((javax.xml.rpc.Stub)dealService)._setProperty("javax.xml.rpc.service.endpoint.address", _endpoint);
        else
          _endpoint = (String)((javax.xml.rpc.Stub)dealService)._getProperty("javax.xml.rpc.service.endpoint.address");
      }
      
    }
    catch (javax.xml.rpc.ServiceException serviceException) {}
  }
  
  public String getEndpoint() {
    return _endpoint;
  }
  
  public void setEndpoint(String endpoint) {
    _endpoint = endpoint;
    if (dealService != null)
      ((javax.xml.rpc.Stub)dealService)._setProperty("javax.xml.rpc.service.endpoint.address", _endpoint);
    
  }
  
  public pe.edu.upc.dsd.deal.service.DealService getDealService() {
    if (dealService == null)
      _initDealServiceProxy();
    return dealService;
  }
  
  public void save(pe.edu.upc.dsd.deal.service.Deal deal) throws java.rmi.RemoteException{
    if (dealService == null)
      _initDealServiceProxy();
    dealService.save(deal);
  }
  
  public void update(pe.edu.upc.dsd.deal.service.Deal deal) throws java.rmi.RemoteException{
    if (dealService == null)
      _initDealServiceProxy();
    dealService.update(deal);
  }
  
  public pe.edu.upc.dsd.deal.service.Deal find(java.lang.String isbn) throws java.rmi.RemoteException{
    if (dealService == null)
      _initDealServiceProxy();
    return dealService.find(isbn);
  }
  
  public pe.edu.upc.dsd.deal.service.Deal[] findAll() throws java.rmi.RemoteException{
    if (dealService == null)
      _initDealServiceProxy();
    return dealService.findAll();
  }
  
  public void delete(pe.edu.upc.dsd.deal.service.Deal deal) throws java.rmi.RemoteException{
    if (dealService == null)
      _initDealServiceProxy();
    dealService.delete(deal);
  }
  
  
}